package patterns.absfactory;

/**
 * Created by lenovo on 2016/11/22 0022.
 * Color工厂类，继承自AbstractFactory，对外提供IColor的接口对象
 */
public class ColorFactory extends AbstractFactory{
    //此处不需要实现具体的shape方法
    @Override
    IShape getShape(String shapeType) {
        return null;
    }

    @Override
    IColor getColor(String colorType) {
        if (colorType==null){
            return null;
        }
        if (colorType.equalsIgnoreCase("RED")){
            return new Red();
        }else if (colorType.equalsIgnoreCase("BLUE")){
            return new Blue();
        }else if (colorType.equalsIgnoreCase("GREEN")){
            return new Green();
        }
        return null;
    }
}
